package com.itheima.d8_thread_pool.ZengTest;

import java.util.concurrent.*;

/**
 * @ClassName ZengThreadPoolTest2
 * @Author 16799
 * @Date 2025/9/23 21:08
 * @Version 1.0
 * @Description TODO
 **/
public class ZengThreadPoolTest2 {
    public static void main(String[] args) throws Exception {
        ExecutorService zpool = new ThreadPoolExecutor(2,5,10, TimeUnit.SECONDS,
                new LinkedBlockingDeque<>(6),Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.CallerRunsPolicy());

        Future<String> z1 = zpool.submit(new ZengMyCallable(10));
        Future<String> z2 = zpool.submit(new ZengMyCallable(20));

        System.out.println(z1.get());   //有异常直接抛出
        System.out.println(z2.get());
    }
}
